package com.wwzz.controller;

import com.wwzz.model.User;
import com.wwzz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController2 {
    private UserService userService;

    // 方法二: 构造方法注入是在类的构造方法种实现注入
    @Autowired
    public UserController2(UserService userService) {
        this.userService = userService;
    }
    public User findUserById(Integer id){
        if(id == null){
            return  null;
        }
        return userService.findUserById(id);
    }
}
